// 引用vue，安装路由
import Vue from "vue";
import VueRouter from "vue-router";


import Home from "../views/Home.vue"
import User from "../views/User.vue"
import Mall from "../views/Mall.vue"
import Main from "@/views/Main.vue"
import PageOne from "@/views/PageOne.vue"
import PageTwo from "@/views/PageTwo.vue"

 

// 安装路由
Vue.use(VueRouter)

const routes =[
    {
        path:'/',
        component:Main,
        redirect:'/home',
        children:[
            {path:'/mall',component:Mall},
            {path:'/user',component:User},
            {path:'/home',component:Home},
            {path:'/page1',component:PageOne},
            {path:'/page2',component:PageTwo},

        ]
    },

]


// 3. 创建 router 实例，然后传 `routes` 配置
const router = new VueRouter({
    routes // (缩写) 相当于 routes: routes
})

export default router
  